{/* LAYOUT模板 */}
<layout name="layout"/>
{/* LAYOUT模板 */}
{/* import Js,Css */}	
<css href="__PUBLIC__/css/jquery-ui.css" />
<css href="__THEMES__/css/yx.css" />
<css href="__PUBLIC__/css/style.css" />
<js href="__PUBLIC__/js/core/jquery-ui.1.10.4.js" />
{/* import js,css */}

<div style="width:100%;height:90px;"><!--空格--></div>

<style>
/*设置头部样式*/
.qheader{background:#fff;height:90px; position:absolute;z-index:1000;top:0px;left:0px;border-bottom:1px solid #f0f0f0;}
.qheader-menu .menu li a {color:#404040;}
.qheader-menu li span{display:inline-block;line-height:45px; font-size:14px;color:#404040; margin-left:15px;cursor:pointer;}
</style>

<div class="maindom">
	<div class="store_main">
        <div class="slt_wrap">
            <div class="slt_main" id="selectMain" style="padding-top:20px;">
                <h1 class="title">
                   <if condition="$cfg['show_goodssn']">
						{$goods.goods_name}
					</if>
                </h1>
                <div class="pro_info">
                    <h2 class="price" id="price">
                        <span class="older">
                        </span>
                        <span class="newer" style="font-size:18px;">
                            ￥{$goods.shop_price_formated}
                        </span>
                    </h2>
                    <div class="pro_info_cnt">                        
						<!-- {* 开始循环所有可选属性 *} -->		
						<div class="pro_info">
							<div class="pro_info_cnt cnt_hier">
								<span class="label_info">
									版本
								</span>
								<div class="ver_wrap" id="verWrap">
									<a class="ver_btn first" data-flag="1" data-index="0">
										教育版
									</a>
									<a class="ver_btn ver_selt" data-flag="2" data-index="1">
										音乐版
									</a>
									<a class="ver_btn" data-flag="3" data-index="2">
										HiFi发烧版
									</a>
								</div>
							</div>
						</div>



						
							<volist name="specification" id="spec" key="spec_key">
							<div class="pro_info">
								<div class="pro_info_cnt cnt_hier">
									<span class="label_info">
										{$spec.name}:
									</span>
									<!-- {* 判断属性是复选还是单选 *} -->									
									<if condition="$spec['attr_type'] eq 1">
										<if condition="$cfg['goodsattr_style'] eq 1">
											<volist name="spec['values']" id="value" key="key">
												<div class="ver_wrap" id="verWrap">
													<input type="radio" style="display:none;" name="spec_{$spec_key}" value="{$value.id}" id="spec_value_{$value.id}" <if condition="$key eq 0">checked</if> onclick="changePrice()" />
													<a class="ver_btn first" data-flag="1" data-index="0" for="spec_value_{$value.id}">
														{$value.label} 
														<!--[<if condition="$value['price'] gt 0">{$lang.plus}<elseif condition="$value['price'] lt 0"/>{$lang.minus}</if> {$value.format_price}] -->
													</a>
												</div>
											</volist>
											<input type="hidden" name="spec_list" value="{$key}" />
										<else/>								
											<select name="spec_{$spec_key}" onchange="changePrice()">
												<volist name="$spec['values']" id="value" key="key">
													<option label="{$value.label}" value="{$value.id}">
														{$value.label} 
														<if condition="$value['price'] gt 0">
															{$lang.plus}
														<elseif condition="$value['price'] lt 0"/>
															{$lang.minus}
														</if>
														<if condition="$value['price'] neq 0">
															{$value.format_price}
														</if>
													</option>
												</volist>
											</select>
											<input type="hidden" name="spec_list" value="{$key}" />
										</if>
									<else/>
										<volist name="$spec['values']" id="value" key="key">
											<label for="spec_value_{$value.id}">
												<input type="checkbox" name="spec_{$spec_key}" value="{$value.id}" id="spec_value_{$value.id}" onclick="changePrice()" />
												{$value.label} 
												[<if condition="$value['price'] gt 0">
													{$lang.plus}
												<elseif condition="$value['price'] lt 0"/>
													{$lang.minus}
												</if>
												{$value.format_price}] 
											</label>
											<br/>
										</volist>
										<input type="hidden" name="spec_list" value="{$key}" />
									</if>
								</div>
							</div>
							<div class="space10" style="width:100%;height:10px;"><!--空格--></div>
							</volist>
						
                        <ul class="color_wrap" id="colorWrap" style="display:none;">
                            <li class="pro_color pro_selt" data-flag="0" data-index="0">
                                <span class="pro_black">
                                    <i>
                                    </i>
                                </span>
                                <p>
                                    木纹
                                </p>
                            </li>
                            <li class="pro_color" data-flag="1" data-index="1">
                                <span class="pro_white">
                                    <i>
                                    </i>
                                </span>
                                <p>
                                    纯白
                                </p>
                            </li>
                            <li class="pro_color" data-flag="2" data-index="2">
                                <span class="pro_gray">
                                    <i>
                                    </i>
                                </span>
                                <p>
                                    纯黑
                                </p>
                            </li>
                        </ul>
                        <div class="clear">
                        </div>
                    </div>
                </div>
                <div class="pro_info">
                    <div class="pro_info_cnt cnt_hier">
                        <span class="label_info">
                            版本
                        </span>
                        <div class="ver_wrap" id="verWrap">
                            <a class="ver_btn first" data-flag="1" data-index="0">
								教育版
                            </a>
                            <a class="ver_btn ver_selt" data-flag="2" data-index="1">
                                音乐版
                            </a>
                            <a class="ver_btn" data-flag="3" data-index="2">
                                HiFi发烧版
                            </a>
                        </div>
                    </div>
                </div>
                <div class="pro_info" style="display: none;">
                    <div class="pro_info_cnt cnt_hier">
                        <span class="label_info">
                            合约
                        </span>
                        <ul class="ver_wrap" id="saleWrap">
                        </ul>
                    </div>
                </div>
                <div class="pro_info">
                    <div class="pro_info_cnt cnt_hier">
                        <span class="label_info">
                            容量
                        </span>
                        <div class="cap_wrap" id="capWrap">
                            <a class="cap_btn" data-index="0" data-flag="2" data-btn="0" data-id="286"
                            data-stock="0" data-price="1299.00" data-package="4,5">
                                <span class="cap_num">
                                    16G
                                </span>
                                <span class="cap_price">
                                    ￥1299
                                </span>
                            </a>
                            <a class="cap_btn cap_selt" data-index="1" data-flag="3" data-btn="0"
                            data-id="287" data-stock="44047" data-price="1399.00" data-package="4,5">
                                <span class="cap_num">
                                    32G
                                </span>
                                <span class="cap_price">
                                    ￥1399
                                </span>
                            </a>
                            <a class="cap_btn" data-index="2" data-flag="4" data-btn="0" data-id="288"
                            data-stock="0" data-price="2099.00" data-package="4,5">
                                <span class="cap_num">
                                    64G
                                </span>
                                <span class="cap_price">
                                    ￥2099
                                </span>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="pro_info">
                    <div class="pro_info_cnt cnt_lier">
                        <span class="label_info s_label">
                            数量
                        </span>
                        <ul class="ver_wrap">
                            <li class="pro_add_wrap">
                                <a href="javascript:void(0)" class="pro_minus" data-goods-id="{$goods.goods_id}">
                                    -
                                </a>
                                <span id="buy_count" class="input" data-goods-id="{$goods.goods_id}">
                                    1
                                </span>
                                <a href="javascript:void(0)" class="pro_add" data-goods-id="{$goods.goods_id}">
                                    +
                                </a>
                            </li>
                            <li class="pro_num_tip">
                                （限购
                                <span>
                                    5
                                </span>
                                件）
                            </li>
                        </ul>						
                        <div class="clear">
                        </div>
                    </div>
                </div>
                <div class="pro_info">
                    <div class="pro_info_cnt cnt_bier">
                        <a href="javascript: void(0)" class="bug_btn" id="buyBtn">
                            立即购买
                        </a>
                        <a href="javascript: void(0)" class="add_btn set_mrg" id="addBtn">
                            加入购物车
                        </a>
                    </div>
					<script>
						/*改变购买数量*/
						/*加*/
						$('.pro_add').click(function(){
							var count		=	 parseInt($('#buy_count').text()) + 1;
							$('#buy_count').text(count);
						});
						/*减*/
						$('.pro_minus').click(function(){
							var count		=	parseInt($('#buy_count').text()) - 1;	
							if(count == 1 || count < 1){
								$('#buy_count').text('1');
								return;
							}
							else{
								$('#buy_count').text(count);
							}								
						});	
						/*加入购物车*/
						$('#addBtn').click(function(){
							
						});
					</script>
                    <div class="pro_desc" id="errorTip" style="display: none;">
                        库存不足
                    </div>
                    <div class="pro_desc gift_info">
                    </div>
                    <div class="pro_desc" id="fittingText">
                        MX3手机主机，USB数据线，开盖拨片，保修卡，快速入门指南，电源适配器
                    </div>
                </div>
            </div>
        </div>
        <div class="slide_wrap" id="slideWrap">
            <div class="slide_item" style="display: block; background-image: url(http://storeimg.meizu.com/product/1409571229-70155.png);">
            </div>
            <div class="slide_item" style="display: none; background-image: url(http://storeimg.meizu.com/product/1409629143-23547.png);">
            </div>
            <div class="slide_item" style="display: none; background-image: url(http://storeimg.meizu.com/product/1409571241-81405.png);">
            </div>
        </div>
        <ul class="high_light" id="highLight">
            <li class="cur" data-index="0" style="display: list-item;">
            </li>
            <li data-index="1" style="display: list-item;">
            </li>
            <li data-index="2" style="display: list-item;">
            </li>
        </ul>
    </div>
	
	
	<!--技术参数-->
	<div class="store_detail " STYLE="display:block;">
        <div class="detail_head">
            <div class="dtl_nav_f cur">
                技术规格
            </div>
            <div class="dtl_nav unpointer">
                &nbsp;
            </div>
            <div class="dtl_empt">
            </div>
        </div>
        <table class="dtl_info" id="dtlInfoView">
            <tbody>
                <tr>
                    <td class="dtl_type">
                        外观尺寸
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        尺寸：139.0×71.9×9.1mm
                        <br>
                        重量：143g
                    </td>
                    <td class="dtl_img">
                        <img src="http://store.res.meizu.com/resources/php/store/images/newver/91mm.png"
                        alt="外观尺寸">
                    </td>
                </tr>
                <tr>
                    <td class="dtl_type">
                        颜色
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        前黑后白、白色（后盖采用IML薄壁成型技术）
                    </td>
                    <td class="dtl_img">
                    </td>
                </tr>
                <tr>
                    <td class="dtl_type">
                        容量
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        16GB
                        <span>
                            32GB
                        </span>
                        64GB
                        <span>
                            128GB（仅MX3 TD）
                        </span>
                    </td>
                    <td class="dtl_img">
                    </td>
                </tr>
                <tr>
                    <td class="dtl_type">
                        系统
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        Flyme 3.0（基于Android 4.2）
                    </td>
                    <td class="dtl_img">
                    </td>
                </tr>
                <tr>
                    <td class="dtl_type">
                        网络
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        <p>
                            MX3 移动版：支持移动3G网络，以及移动、联通2G网络
                        </p>
                        <p>
                            MX3 联通版：支持联通3G网络，以及联通、移动2G网络
                        </p>
                        <p>
                            MX3 联通合约版：支持联通3G网络，以及联通、移动2G网络
                        </p>
                    </td>
                    <td class="dtl_img">
                    </td>
                </tr>
                <tr>
                    <td class="dtl_type">
                        芯片
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        CPU： Exynos 5410智能8核处理器
                        <br>
                        GPU： PowerVR SGX 544MP3（三核533MHz）
                    </td>
                    <td class="dtl_img">
                        <img src="http://store.res.meizu.com/resources/php/store/images/newver/ex5.png"
                        alt="外观尺寸">
                    </td>
                </tr>
                <tr>
                    <td class="dtl_type">
                        屏幕
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        尺寸：5.1吋（New Mode2）
                        <br>
                        分辨率：1800×1080（黄金1080P）
                        <br>
                        PPI：415像素/吋
                    </td>
                    <td class="dtl_img">
                    </td>
                </tr>
                <tr>
                    <td class="dtl_type">
                        摄像头
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        前置：200万索尼背照式、美颜自拍
                        <br>
                        后置：索尼第三代800万背照式，光场拍照、零延时防抖拍照、每秒25张极速连拍（世界领先）、人脸识别、手势拍照
                    </td>
                    <td class="dtl_img">
                    </td>
                </tr>
                <tr class="dtl_row_last">
                    <td class="dtl_type">
                        电池
                    </td>
                    <td class="dtl_blank">
                    </td>
                    <td class="dtl_desc">
                        索尼2400mAh内置锂聚合物电池
                        <br>
                        待机时间：3G待机长达393小时，2G待机长达429小时
                    </td>
                    <td class="dtl_img">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
	<!--技术参数-->
</div>



<script type="text/javascript">
	function $id(element) {
		return document.getElementById(element);
	}
	//切屏--是按钮，_v是内容平台，_h是内容库
	function reg(str){
		var bt			=	$id(str+"_b").getElementsByTagName("h2");
		for(var i=0;i<bt.length;i++){
			bt[i].subj	=	str;
			bt[i].pai	=	i;
			bt[i].style.cursor	=	"pointer";
			bt[i].onclick=function(){
				$id(this.subj+"_v").innerHTML	=	$id(this.subj+"_h").getElementsByTagName("blockquote")[this.pai].innerHTML;
				for(var j=0;j<$id(this.subj+"_b").getElementsByTagName("h2").length;j++){
					var _bt=$id(this.subj+"_b").getElementsByTagName("h2")[j];
					var ison	=	j	==	this.pai;
					_bt.className=(ison?"":"h2bg");
				}
			}
		}
		$id(str+"_h").className	=	"none";
		$id(str+"_v").innerHTML	=	$id(str+"_h").getElementsByTagName("blockquote")[0].innerHTML;
	}
	
	/* *
	 * 添加商品到购物车 
	 */
	function addToCart(goodsId, parentId){
		var goods        = new Object();
		var spec_arr     = new Array();
		var fittings_arr = new Array();
		var number       = 1;
		var formBuy      = document.forms['ECS_FORMBUY'];
		var quick		   = 0;

		// 检查是否有商品规格 
		if (formBuy){
				spec_arr = getSelectedAttributes(formBuy);

			if (formBuy.elements['number']){
			  number = formBuy.elements['number'].value;
			}

			quick = 1;
		}

		goods.quick    = quick;
		goods.spec     = spec_arr;
		goods.goods_id = goodsId;
		goods.number   = number;
		goods.parent   = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
		
		//Ajax.call('flow.php?step=add_to_cart', 'goods=' + goods.tojsONString(), addToCartResponse, 'POST', 'jsON');
		$.ajax({
			url:'__URL__/add_to_cart',
			type:'post',
			dataType:'json',
			data:{goods:goods},
			beforeSend:function(){},
			success:function(msg){
				alert(msg);
			}
		});
	}
		
	/**
	 * 获得选定的商品属性
	 */
	function getSelectedAttributes(formBuy){
		var spec_arr = new Array();
		var j = 0;
		for (i = 0; i < formBuy.elements.length; i ++ ){
			var prefix = formBuy.elements[i].name.substr(0, 5);
			if (prefix == 'spec_' && (((formBuy.elements[i].type == 'radio' || formBuy.elements[i].type == 'checkbox') && formBuy.elements[i].checked) || formBuy.elements[i].tagName == 'SELECT')){
				spec_arr[j] = formBuy.elements[i].value;
				j++ ;
			}
		}
		return spec_arr;
	}
		
</script>

<script type="text/javascript">
	var goods_id = {$goods_id};
	var goodsattr_style = {$cfg.goodsattr_style};
	//var gmt_end_time = {$promote_end_time};
	var goodsId = {$goods_id};
	//var now_time = {$now_time};

	onload = function(){
		changePrice();
		//fixpng();
		try { onload_leftTime(); }
		catch (e) {}
	}

	/**
	 * 点选可选属性或改变数量时修改商品价格的函数
	 */
	function changePrice(){
		var attr 	= 	getSelectedAttributes(document.forms['ECS_FORMBUY']);
		var qty 	= 	document.forms['ECS_FORMBUY'].elements['number'].value;
		//Ajax.call('goods.php', 'act=price&id=' + goodsId + '&attr=' + attr + '&number=' + qty, changePriceResponse, 'GET', 'jsON');
		$.ajax({
			url:'__URL__/change_price?' + 'act=price&id=' + goodsId + '&attr=' + attr + '&number=' + qty,
			type:'get',
			dataType:'json',
			data:{},
			beforeSend:function(){},
			success:function(msg){
				changePriceResponse(msg);
			}
		});
	}

	/**
	 * 接收返回的信息
	 */
	function changePriceResponse(res){
		if (res.err_msg.length > 0){
			alert(res.err_msg);
		}
		else{
			document.forms['ECS_FORMBUY'].elements['number'].value = res.qty;
			if (document.getElementById('ECS_GOODS_AMOUNT'))
			document.getElementById('ECS_GOODS_AMOUNT').innerHTML = res.result;
		}
	}
	
</script>





<div class="space90" style="width:100%;height:90px;"><!--空格--></div>
<include file="Library:service"/>
<include file="Library:footer"/>




